Skip to content

Reduce provider update pill rerenders#2802

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/react-component-health-7cbf
Draft

Reduce provider update pill rerenders#2802
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/react-component-health-7cbf

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 25, 2026

What Changed

  • Reworked SidebarProviderUpdatePill so the initial provider-status cutoff is kept in a ref instead of mirrored through state/effect.
  • Moved transition-only bookkeeping (pendingView, dismiss-after-exit key) into refs inside a named display hook so those values do not schedule renders themselves.
  • Moved remaining necessary effects into named hooks for display transition synchronization and auto-dismiss timing.

Why

react-doctor flagged this component for derived state and handler-only state that could cause avoidable rerenders. After the change, the targeted component diagnostics dropped from 11 to 6, including removal of the handler-only state warnings and the visibleAfterIso derived-state warning.

React Scan recordings were captured with a temporary Vite harness and the React Scan script enabled:

  • Before: /workspace/artifacts/react-scan/sidebar-provider-update-before.webm
  • After: /workspace/artifacts/react-scan/sidebar-provider-update-after.webm

UI Changes

No intended visual changes. The before/after videos above exercise the provider update pill loading-to-success transition with React Scan enabled.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Verification:

  • bun fmt
  • bun lint
  • bun typecheck
  • bunx react-doctor --full --no-score --json apps/web
Open in Web View Automation 

Note

Reduce rerenders in SidebarProviderUpdatePill by extracting hooks

Refactors SidebarProviderUpdatePill.tsx to move stateful logic into three dedicated hooks, replacing component state with refs where possible to avoid unnecessary rerenders.

  • useProviderUpdateVisibleAfterIso captures the initial visibleAfter timestamp in a ref so it stays stable across renders
  • useDisplayedProviderUpdatePill manages view transition and exit logic using refs for pending state instead of component state
  • useProviderUpdateAutoDismiss encapsulates the auto-dismiss timeout, replacing an inline effect

Macroscope summarized 8b2adcc. (Automatic summaries will resume when PR exits draft mode or review begins).

Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 25, 2026
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant